$(function(){
	var data={
		
	}
	function loadajax(type,php_url,datas,fn){  //封装ajax
		$.ajax({
			type:type,      
			url:php_url,    
			async:true,     
			data:datas,     
			dataType:'json', 
			success:function(msg){
				if(fn){
					fn(msg);
				}
			},error:function(msg){
				alert('ajax连接失败！');
			}
		});
	}
	//	主页轮播图
	
	function banners(msg){
		var html='';
		var oLi = '';
		for(var i = 0 ; i < msg.length ;i++){
					if(i == 0){
						oLi += '<li class="active" data-slide-to="'+i+'" data-target="#carousel-135899"></li>';
						html += '<div class="item active"><img alt="" src="'+msg[i]['banner_src'] +'"/></div>';
					}else{
						oLi += '<li data-slide-to="'+i+'" data-target="#carousel-135899"></li>';
						html += '<div class="item"><img alt="" src="'+msg[i]['banner_src'] +'"/></div>';
					}
				}
				$('.carousel-indicators').html(oLi);
				$('.carousel-inner').html(html);
	    }
	
	loadajax('post',"index.php?m=home&c=index&a=getBanner",data,banners);	
	
	
	
//	关于页面关于模块
	function about(msg){
		var html='';
			html= '<div class="left_1 col-lg-6 col-sm-12 col-md-12 col-xs-12 thumbnail"><img src="'+msg[0]['img_src']+
			'"/></div><div class="right_1 col-lg-6 col-sm-12 col-md-12 col-xs-12" id="content_text1"><p>'+msg[0]['article']+
			'</p></div>';
			$('.about_cont_1').html(html);
	}
	loadajax('post',"index.php?m=home&c=article&a=about",data,about);
	
//	关于页面工艺模块
	function about_t(msg){
		var html='';
		html= '<div class="right_2 col-lg-6 col-sm-12 col-md-12 col-xs-12" id="content_text1"><p>'
		+msg[1]['article']
		+'</p></div>'
		+'<div class="left_2 col-lg-6 col-sm-12 col-md-12 col-xs-12 thumbnail"><img src="'
		+msg[1]['img_src']
		+'"/></div>';
		$('.about_cont_2').html(html);
	}
	
	loadajax('post',"index.php?m=home&c=article&a=about",data,about_t);
})